var openwin = (title, content, data = {}) => {
    // 默认PC为垂直水平居中
    var offset = 'auto'
    if (/mobile/i.test(navigator.userAgent) || /android/i.test(navigator.userAgent)) {
        // 手机默认为左下角
        offset = 'lb'
    }

    var area = ['100%', '100%']
    if (data.area) {
        switch (data.area) {
            case 'mini':area = ['600px', '500px'];break;
        }
    }

    var maxmin = data.maxmin != undefined ? data.maxmin : false
    var index = layer.open({
        title: title,
        type: 2,
        shade: 0.2,
        maxmin:maxmin,
        shadeClose: false,
        area: area,
        content: content,
        fixed: false,
        offset: offset,
        success: function (layero, index) {

        },
    });
}

var getUrlParam = (param) => {
   var query = window.location.search.substring(1);
   var vars = query.split("&");
   for (var i=0;i<vars.length;i++) {
       var pair = vars[i].split("=");
       if(pair[0] == param){return pair[1];}
   }
   return '';
}

export {openwin,getUrlParam}